import { parser } from "../parser/index";
import { any } from "../../core/logic"
var onmessage=function(ev){
    //子线程接收到消息后进行消息的处理，并将处理结果通知主线程
    const message=any(ev.data,"");
    parser[message.type](message,(respond)=>{
        if(respond.transferlist&&respond.transferlist.length>0){
            postMessage({"type":message.type,"id":message.id,"data":respond.data},respond.transferlist);
        }else{
            postMessage({"type":message.type,"id":message.id,"data":respond.data});
        }
            
    });
}
export default onmessage;